<?php 
//CSDL SQL
//print_r($arr_all_recordtype);
//echo sizeof($arr_all_recordtype);
if(isset($_POST['Submit'])){
	$v_note = '';

	if(_is_sqlserver()){
		for($i=0;$i<sizeof($arr_all_recordtype);$i++){
			$name = $arr_all_recordtype[$i]['PK_RECORDTYPE'] .' '.$_POST['textfield'];
			$v_cate_id = $arr_all_recordtype[$i]['PK_RECORDTYPE'];
			$v_recordtype = $arr_all_recordtype[$i]['PK_RECORDTYPE'];
			$v_code = $_POST['code'].$arr_all_recordtype[$i]['PK_RECORDTYPE'];
			$v_file_name =  $arr_all_recordtype[$i]['PK_RECORDTYPE'].'_'.$_POST['filename'];

			$sql = " Insert into T_ONEGATE_REPORT_TYPE (C_CODE,C_NAME,C_NOTE,C_FILE_NAME,C_ORDER,C_STATUS,FK_RECORDTYPE)			Values('".$v_code."','".$name."','".$v_note."','".$v_file_name."',1,1,'".$v_cate_id."')";

			$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
			$rs = $ado_conn->GetRow($sql); 
			$v_error = _replace_bad_char(trim($rs['RET_ERROR']));
		}
	}
}
?>
<form action="index.php" method="post" name="f_back">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="18%">&nbsp;</td>
        <td width="82%">&nbsp;</td>
      </tr>
	   <tr>
        <td>Ma: </td>
        <td><input type="text" name="code" /></td>
      </tr>
      <tr>
        <td>T&ecirc;n report: </td>
        <td><input type="text" name="textfield" size="50" /></td>
      </tr>
	  <tr>
        <td>T&ecirc;n file: </td>
        <td><input type="text" name="filename" size="50" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="Submit" value="C&#7853;p nh&#7853;t" />
           </td>
      </tr>
    </table>
	<input type="hidden" name="fuseaction" value="AUTO_UPDATE_REPORT_TYPE">
	<input name="hdn_recordtype_id" type="hidden" value="<?php echo $v_recordtype_id; ?>">
</form>